const path = require("path");
const webpack = require('webpack')
let JX_ENV = require('./config/index')
if (process.env.NODE_ENV == 'development') {
  // const getDetailContent = require('./getQiniuImg')
}

function resolve(dir) {
  return path.join(__dirname, dir);
}
module.exports = {
  publicPath: JX_ENV.publicPath,
  chainWebpack: config => {
    config.resolve.alias.set('@', resolve('src')) // key,value自行定义，比如.set('@@', resolve('src/components'))
    config.module.rule('svg').uses.clear()
    config.module
      .rule('svg1')
      .test(/\.svg$/)
      .use('svg-sprite')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]'
      })
      .end()
      .include.add(resolve('src/icons'))
      .end()
  },
  configureWebpack: {
    plugins: [
      new webpack.DefinePlugin({
        JX_ENV: JSON.stringify(JX_ENV)
      })
    ],
    externals: {
      AMap: 'AMap'
    }
  },
  devServer: {
    port: 7001
  },
}
